
use "C:\Users\mcsam\Dropbox\Decomposing Firm Betas\Submissions\JPE Macro\Replication Folder\Table_5_data",clear
local k = 1

*loop over outcomes
foreach lhs in betaw1 ivolw1{
	if "`lhs'"=="betaw1"{
		local ctitle="CAPM $\beta$"
	}
	else if "`lhs'"=="ivolw1"{
		local ctitle="Idio. Vol."
	}
	** just churn (univariate)
	reg `lhs' chshare lnlagrev ,cluster(permno)
	if `k'==1{
	outreg2 using churnvol, title() keep()  drop() label addtext(Specification, Univar) ctitle("`ctitle'") nocons replace
		local k = 2	
	}
	else{
		outreg2 using churnvol, title() keep()  drop() label addtext(Specification, Univar) ctitle("`ctitle'") nocons append
	}

	** churn + industry fixed effects, SIC2
	areg `lhs' chshare lnlagrev , a(g2) cluster(permno)
	outreg2 using churnvol, title() keep()  drop() label addtext(Specification, SIC2 FE) ctitle("`ctitle'") nocons 
	
	** churn + industry fixed effects, HP50
	reghdfe `lhs' chshare lnlagrev , a(g4#year) cluster(permno)  keepsingletons 
	outreg2 using churnvol, title() keep()  drop() label addtext(Specification, SIC1 X Year) ctitle("`ctitle'") nocons 

	** churn + firm fixed effects
	areg `lhs' chshare lnlagrev , a(permno) cluster(permno)
	outreg2 using churnvol, title() keep()  drop() label addtext(Specification, Firm FE) ctitle("`ctitle'") nocons 

}
